package com.angel.mocks.factories;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.apache.commons.lang.RandomStringUtils;

import com.angel.mocks.io.User;

public class UserFactory {

	private UserFactory(){
		super();
	}

	public static User createEmptyUser(){
		return new User();
	}

	public static List<User> createUser(int quantity){
		List<User> result = new ArrayList<User>();
		for(int i = 0; i< quantity; i++){
			result.add(createUser());
		}
		return result;
	}

	public static User createUser(){
		User user = createEmptyUser();
		user.setAge(Integer.valueOf(RandomStringUtils.randomNumeric(2)));
		user.setName(RandomStringUtils.randomAlphabetic(12));
		user.setUserName(RandomStringUtils.randomAlphabetic(15));
		user.setUserPassword(RandomStringUtils.randomAlphabetic(18));
		user.setRoleName(RandomStringUtils.randomAlphabetic(18));
		user.setSurname(RandomStringUtils.randomAlphabetic(20));
		user.setDateBorned(new Date(System.currentTimeMillis() - Integer.valueOf(RandomStringUtils.randomNumeric(5))));
		return user;
	}
}
